Skip to content

ref(dynamic-sampling): Drop CustomDynamicSamplingRule tables#112453

Merged
shellmayr merged 4 commits intomasterfrom
simon-hellmayr/ref/delete-customdynamicsamplingrule-tables
Apr 9, 2026
Merged

ref(dynamic-sampling): Drop CustomDynamicSamplingRule tables#112453
shellmayr merged 4 commits intomasterfrom
simon-hellmayr/ref/delete-customdynamicsamplingrule-tables

Conversation

@shellmayr
Copy link
Copy Markdown
Member

@shellmayr shellmayr commented Apr 8, 2026

Step 2 of the table deletion process: physically drop the sentry_customdynamicsamplingrule and sentry_customdynamicsamplingruleproject tables from PostgreSQL.
The previous migration (1063) already removed foreign key constraints and moved the models to pending deletion state.

Closes TET-1957

Step 2 of the table deletion process: physically drop the
sentry_customdynamicsamplingrule and sentry_customdynamicsamplingruleproject
tables from PostgreSQL. The previous migration (1063) already removed
foreign key constraints and moved the models to pending deletion state.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@linear-code
Copy link
Copy Markdown

linear-code bot commented Apr 8, 2026

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Apr 8, 2026
@shellmayr shellmayr marked this pull request as ready for review April 8, 2026 07:41
@shellmayr shellmayr requested a review from a team as a code owner April 8, 2026 07:41
@shellmayr shellmayr changed the title ref(migrations): Drop CustomDynamicSamplingRule tables ref(dynamic-sampling): Drop CustomDynamicSamplingRule tables Apr 8, 2026
Copy link
Copy Markdown
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

Bugbot Autofix prepared fixes for both issues found in the latest run.

  • ✅ Fixed: Missing historical_silo_assignments prevents table drops from executing
    • Added sentry_customdynamicsamplingrule and sentry_customdynamicsamplingruleproject to historical_silo_assignments in router.py with SiloMode.CELL so the SafeDeleteModel DELETE operations can resolve the database and execute DROP TABLE.
  • ✅ Fixed: Lockfile not updated for new migration head
    • Updated migrations_lockfile.txt to point to 1065_delete_customdynamicsamplingrule as the new sentry migration head.

Create PR

Or push these changes by commenting:

@cursor push a55b9dce76
Preview (a55b9dce76)
diff --git a/migrations_lockfile.txt b/migrations_lockfile.txt
--- a/migrations_lockfile.txt
+++ b/migrations_lockfile.txt
@@ -31,7 +31,7 @@
 
 seer: 0005_delete_seerorganizationsettings
 
-sentry: 1064_eventattachment_date_expires_now
+sentry: 1065_delete_customdynamicsamplingrule
 
 social_auth: 0003_social_auth_json_field
 

diff --git a/src/sentry/db/router.py b/src/sentry/db/router.py
--- a/src/sentry/db/router.py
+++ b/src/sentry/db/router.py
@@ -89,6 +89,8 @@
         "sentry_projecttemplate": SiloMode.CELL,
         "sentry_projecttemplateoption": SiloMode.CELL,
         "uptime_projectuptimesubscription": SiloMode.CELL,
+        "sentry_customdynamicsamplingrule": SiloMode.CELL,
+        "sentry_customdynamicsamplingruleproject": SiloMode.CELL,
         "workflow_engine_actiongroupstatus": SiloMode.CELL,
         "workflow_engine_workflowaction": SiloMode.CELL,
     }

This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 79f00d3. Configure here.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

This PR has a migration; here is the generated SQL for src/sentry/migrations/1065_delete_customdynamicsamplingrule.py

for 1065_delete_customdynamicsamplingrule in sentry

--
-- Delete model CustomDynamicSamplingRuleProject
--
DROP TABLE "sentry_customdynamicsamplingruleproject" CASCADE;
--
-- Delete model CustomDynamicSamplingRule
--
DROP TABLE "sentry_customdynamicsamplingrule" CASCADE;

shellmayr and others added 2 commits April 8, 2026 11:08
…plingRule

Add sentry_customdynamicsamplingrule and sentry_customdynamicsamplingruleproject
to historical_silo_assignments so that the deletion migration can resolve
the correct database in test environments.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@shellmayr shellmayr merged commit 18c64fa into master Apr 9, 2026
77 of 78 checks passed
@shellmayr shellmayr deleted the simon-hellmayr/ref/delete-customdynamicsamplingrule-tables branch April 9, 2026 09:35
george-sentry pushed a commit that referenced this pull request Apr 9, 2026
Step 2 of the table deletion process: physically drop the
sentry_customdynamicsamplingrule and
sentry_customdynamicsamplingruleproject tables from PostgreSQL.
The previous migration (1063) already removed foreign key constraints
and moved the models to pending deletion state.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants